﻿using UnityEngine;
using System.Collections;

public class Plane : MonoBehaviour 
{
	public int maxHp=8;//最大血量
	private int hp;//当前血量
	public GameObject explosionFx;//爆炸特效

	protected virtual void Start()
	{
		hp = maxHp;//开始的时候满血
	}
	/// <summary>
	///受伤
	/// </summary>
	/// <param name="value">伤害值 </param>

	public virtual void Gethurt(int value)
	{
		hp -= value;
			if(hp<=0)
			{
				hp=0;
				Die();//死亡
			}
				
	}

	protected virtual void Die()
	{
		Destroy (this.gameObject);//销毁自己
		Instantiate(explosionFx,transform.position,Quaternion.identity);//生成爆炸特效
	}

}
